package com.renren.webmaven2.service;

import java.util.List;

import com.renren.eliya.domain.BigClass;
import com.renren.eliya.domain.MyBread;
import com.renren.eliya.domain.SmallClass;
import com.renren.webmaven2.util.CacheUtils;
import com.renren.webmaven2.util.Constants;
import com.renren.yx.base.dao.daoutil.InitDao;

@SuppressWarnings("unchecked")
public class MonitorService implements Constants {

	public void work() {
		System.out
				.println("<==================	reflush eliya content start	==================>");
		getBigClasses();
		getSmallClasses();
		getBread();
		System.out
				.println("<==================   reflush eliya content over ==================>");

	}

	public void getBigClasses() {
		List<BigClass> bigClasses = InitDao.getDao().findEntities(
				"from BigClass s order by s.weight");
		CacheUtils.add(NET_CACHE_ALL_BIGCLASS, bigClasses);
	}

	public void getSmallClasses() {
		List<SmallClass> smallClasses = InitDao.getDao().findEntities(
				"from SmallClass s order by s.bigClassId,s.weight");
		CacheUtils.add(NET_CACHE_ALL_SMALLCLASS, smallClasses);
	}

	public void getBread() {
		List<MyBread> breads = InitDao.getDao().findEntities(
				"from MyBread s order by s.id desc");
		CacheUtils.add(NET_CACHE_ALL_BREAD, breads);
	}

}
